<template>
	<div class="app-user">
		<!--名片卡-->

			<div class="user-top">
				<!--<router-link to="/perdata" class="user-topimg"><img :src="(user_img.indexOf('http:/')==-1?'http://www.ntyouxuan.com/'+user_img:user_img)"/></router-link>
				<router-link to="/perdata" class="user-name" v-html="userName"></router-link>-->
				
				<div class="kapian">
					<router-link to="/perdata" class="user-topimg"><img :src="(user_img.indexOf('http:/')==-1?'http://www.ntyouxuan.com/'+user_img:user_img)"/></router-link>
					<router-link to="/perdata" class="user-name" v-html="userName"></router-link>
					<router-link to="/myorder"><img class="wddd" src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/dingdan@2x.png" /></router-link>
					<p style="width: 6.3rem;height: 1px;background-color: #F9F9F9;margin: 0 auto;margin-top: 30.5%;"></p>
					
				</div>
				
			</div>
			
			<!--订单模块-->
			<div class="ddmodel">
				<p style="width: 6.3rem;height: 1px;color: black;"></p>
				<!--<h3 class="dd-all">我的订单<router-link to="/myorder"><img src="../img-user/nextbtn@3x.png"/>查看全部订单</router-link></h3>-->
				<ul class="dd-item">
					<li><router-link to="/myorder/orderpay"><span v-show="dingdanxinxi.pending>0">{{dingdanxinxi.pending}}</span><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/daizhipay.png" alt="" /><p>待支付</p></router-link></li>
					<li><router-link to="/myorder/orderfa"><span v-show="dingdanxinxi.accepted>0">{{dingdanxinxi.accepted}}</span><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/fahuo.png" alt="" /><p>待发货</p></router-link></li>
					<li><router-link to="/myorder/ordershou"><span v-show="dingdanxinxi.shipped>0">{{dingdanxinxi.shipped}}</span><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/daishouhuo.png" alt="" /><p>待收货</p></router-link></li>
					<!--<li><router-link to="/myorder/orderover"><span v-show="dingdanxinxi.finished>0">{{dingdanxinxi.finished}}</span><img src="../img-user/dpj@3x.png" alt="" /><p>待评价</p></router-link></li>-->
					<li><router-link to="/refundsh"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/yy.png" alt="" /><p>退款/售后</p></router-link></li>
				</ul>
			</div>
			<!--选项列表-->
			<div style="width: 100%;height: 2.11rem; background-color: #FFFFFF; margin-top: -30px;"></div>
			<ul class="xl-list-box" v-if="dst_statu==1">
				<li><router-link to="/exorder"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/psdd3bd342d7c14e15-3165-4a14-9f1a-48ecf0b42b0b.png"/></i><span>推广订单</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
				<li><router-link to="/invitecode"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/ps093751e5f8771c62-1cf6-42cc-aae3-363636efe037.png"/><span>我的邀请码</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
			</ul>
			<ul class="xl-list-box">
				<li><router-link to="/informationlist"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_news@2x.png"/><span>我的消息</span><i><img src="../img-user/nextbtn@3x.png"/></i><span class="icon-ts" v-show="newshow!=''"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_new@2x.png"/></span></router-link></li>
				<li><router-link to="/withdraw"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_yue@2x.png"/><span>可用余额</span><i><img src="../img-user/nextbtn@3x.png"/></i><span class="list-tsy">￥ {{money}}</span></router-link></li>
				<li v-if="dst_statu==1"><span><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/ps1dc715241a911f4d-a05d-4f9f-b5ee-2eeca0fd0aa2.png"/><span>预估收入</span><i><img src="../img-user/nextbtn@3x.png"/></i><span class="list-tsy">￥ {{money_dj}}</span></span></li>
			</ul>
			<ul class="xl-list-box">
				<li><router-link to="/perdata"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/zlxg.png"/><span>我的资料</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
				<li><router-link to="/myaddress/addressgl"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_adress@2x.png"/><span>我的地址</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
			</ul>
			<ul class="xl-list-box">
				<li><router-link to="/discount"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_quan@2x.png"/></i><span>我的优惠券</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
				<li><router-link to="/collection"><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/icon_shoucang@2x.png"/><span>我的收藏</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>
				<!--<li><router-link to="/wssj"><img src="../img-user/icon_adress@3x.png"/><span>我是商家</span><i><img src="../img-user/nextbtn@3x.png"/></i></router-link></li>-->
				<li @click="businessplay()"><span><img src="http://liangzhong.oss-cn-hangzhou.aliyuncs.com/newwap/user/sjjjj.png"/><span>我是商家</span><i><img src="../img-user/nextbtn@3x.png"/></i></span></li>
			</ul>
			<navfot></navfot>
	</div>
</template>

<script>
import us from '../css/user.css'
import navfot from '@/components/nav'
	
var furl = 'http://www.ntyouxuan.com/';
	export default {
		name: 'user',
		data() {
			return {
				user:0,
				message_user:Object,
				userName:"",
				user_img:"../img-user/userTOPimg.jpg",
				dst_statu:0,
				dingdanxinxi:{
					pending:0,
					shipped:0,
					finished:0,
					accepted:0
				},
				money:0,
				money_dj:0,
				newshow:"",
				store_status:""
			}
		},
		components:{navfot},
		methods:{
			xinxi:function(user){
				var self=this;
				$.ajax({
					url:furl + "index.php?app=ajax&act=meb_ajax",
					type: "post",
					data:{"token":user},
					asyne: false,
					success:function(data){
						var datas=JSON.parse(data);
						self.dingdanxinxi.pending=datas.retval.buyer_state.pending;
						self.dingdanxinxi.shipped=datas.retval.buyer_state.shipped;
						self.dingdanxinxi.finished=datas.retval.buyer_state.finished;
						self.dingdanxinxi.accepted=datas.retval.buyer_state.accepted;
						self.dst_statu=datas.retval.dst_status;
						localStorage.setItem("nt_stute",self.dst_statu);
						if(datas.retval.user_name&&self.userName!=datas.retval.user_name){
							if(datas.retval.user_name.indexOf('nt_')===0){
								if(datas.retval.wx_name&&self.userName!=datas.retval.wx_name){
									self.userName = datas.retval.wx_name;
								}else if(!datas.retval.wx_name){
									self.userName = datas.retval.user_name;
								}
							}else{
								self.userName = datas.retval.user_name;
							}
						}else if(self.userName!=datas.retval.wx_name&&!self.userName){
							self.userName = datas.retval.wx_name;
						}
						
						if(self.user_img!=datas.retval.portrait){
							self.user_img=datas.retval.portrait;
						}
						self.money=datas.retval.epay.money;
						self.money_dj=datas.retval.epay.money_dj;
						self.newshow=datas.retval.new_message;
						self.store_status=datas.retval.store_status;
					}
				});
			},
			businessplay:function(){
				if(this.store_status==0){
					this.$router.push({path:'/business'});
				}else if(this.store_status==1){
					this.$router.push({path:'/business/businests',query:{"status":"suc1"}});
				}else if(this.store_status==2){
					this.$router.push({path:'/business/businesind'});
				}else if(this.store_status==3){
					this.$router.push({path:'/business/businests',query:{"status":"ero1"}});
				}
				
			}
		},
		mounted:function(){
//			var self=this;
//			var user=localStorage.getItem("nt_user");
//			if(user&&user!=0){
//				this.xinxi(user);
//			}
		},
		undated:function(){
			
		},
		activated:function(){
			$(window).scrollTop(0);
			var self=this;
			var user=localStorage.getItem("nt_user");
			var laiyuan=localStorage.getItem("nt_laiyuan");
			if(!user||user==0){
				this.$router.push({path:"/login"});
			}
			if(laiyuan&&laiyuan=="login"){
				localStorage.removeItem("nt_laiyuan");
				window.location.reload(); 
			}
			this.xinxi(user);
		}
	}
</script>

<style></style>